<template>
  <div>
    <span style="font-size: 28px"><b>用户信息</b></span>
    <div>
      用户名:
      <p>{{ userData.username }}</p>
      性别:
      <p>{{ userData.gender }}</p>
      出生日期:
      <p>{{ userData.birth }}</p>
    </div>
    <router-link v-show="visity" to="/user/login">登录</router-link>
  </div>
</template>

<script>
import bus from "@/components/eventBus";
export default {
  name: "UserInfo",
  data() {
    return {
      username: "",
      gender: "",
      birth: "",
      visity: true,
      userData: {},
    };
  },
  methods: {},
  created() {
    const token = window.sessionStorage.getItem("user");
    if (token != null) {
      this.visity = false;
    } else {
      this.visity = true;
    }
    bus.$on("shareUser", (val) => {
      this.userData = val;
    });
  },
};
</script>

<style scoped>
</style>